/* Copyright (c) 2004-2024 Peigen.info. All rights reserved. */

package info.peigen.hotpot.business.fee.core.domain;

import info.peigen.hotpot.business.account.core.domain.account.Account;
import info.peigen.hotpot.business.fee.facade.enums.FeeMethod;
import info.peigen.hotpot.business.fee.facade.enums.FeeProductCode;
import info.peigen.hotpot.business.fee.facade.enums.FeeType;
import info.peigen.hotpot.common.core.domain.DomainObject;
import info.peigen.hotpot.common.core.enums.Currency;
import info.peigen.hotpot.common.core.enums.YesOrNo;
import info.peigen.hotpot.common.core.util.IdUtil;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import lombok.*;
import lombok.experimental.Accessors;
import lombok.experimental.FieldDefaults;
import lombok.experimental.SuperBuilder;

import static info.peigen.hotpot.business.fee.facade.enums.FeeProductCode.All;
import static info.peigen.hotpot.business.fee.facade.enums.FeeType.Customer;
import static info.peigen.hotpot.common.core.enums.Currency.CNY;
import static info.peigen.hotpot.common.core.enums.YesOrNo.N;
import static info.peigen.hotpot.common.core.enums.YesOrNo.Y;

/**
 * <b>(FeeRule)</b>
 *
 * @author Peigen
 * @version 1.0.0
 * @since 2021/8/26
 */
@EqualsAndHashCode(callSuper = true)
@SuperBuilder
@Data
@NoArgsConstructor
@AllArgsConstructor
@FieldDefaults(level = AccessLevel.PRIVATE)
@Accessors(chain = true)
public class FeeRule extends DomainObject {
    @Builder.Default
    String ruleId = IdUtil.id();
    /** 收费规则名称 */
    @NotEmpty
    String name;
    /** 针对客户收费 */
    Account account;
    /** 针对站点收费 */
    String  stationParentId;
    /** 收费产品码 */
    @Builder.Default
    FeeProductCode code     = All;
    /** 币种-为空则视为全币种 */
    @Builder.Default
    Currency       currency = CNY;
    /** 收费方式 */
    @NotNull
    FeeMethod      method;
    /** 收费规则类型 */
    @Builder.Default
    FeeType        type     = Customer;
    /** 是否计费-默认不计费,直接收费 */
    @Builder.Default
    YesOrNo        billing  = N;
    /** 是否收费-默认收费 */
    @Builder.Default
    YesOrNo        charge   = Y;
    /** 收费规则具体内容 */
    @NotEmpty
    String         context;
    /** 被计费账户 */
    Account billingAccount;
    /** 付费账户 */
    Account payerAccount;
    /** 收费账户 */
    @NotNull
    Account payeeAccount;
    /** memo */
    String memo;
}